import request from '@/utils/request'

// 注册请求
export const userRegisterService = ({ username, password, repassword }) =>
  request.post('/api/reg', {
    username,
    password,
    repassword
  })

//登录请求
export const userLoginService = ({ username, password }) =>
  request.post('/api/login', {
    username,
    password
  })

// 个人信息请求
export const userGetInfoService = () => request.get('/my/userinfo')

// 修改个人信息
export const userChangeInfoService = ({ id, nickname, email }) =>
  request.put('/my/userinfo', { id, nickname, email })

//重置密码
export const userChangePasswordService = ({ old_pwd, new_pwd, re_pwd }) =>
  request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })

//更换头像
export const userUpdateAvatarService = (avatar) =>
  request.patch('/my/update/avatar', { avatar })
